import {
  axios
} from 'utils/util.js';
import {
  post
} from 'utils/util.js';
import {
  urlJoin
} from 'utils/funcs.js';

// 获取子系统列表
export function getMenu(params, succ, fail) {
  // return axios({
  //     url: '/auth/get_menus',
  //     method: 'post',
  //     data: params
  // }).catch(error => {
  //     console.log('获取菜单错误：', error)
  // });
  return post(urlJoin(SERVICE_URL, `/auth/get_menus`), params, succ, fail);
}

// 获取系统二级菜单
export function getSubMenu(params) {
  return axios({
    url: urlJoin(SERVICE_URL, '/portal/link/view/sys/menu/'),
    method: 'post',
    params
  }).catch(error => {
    console.log('错误', error);
  });
}
export function login(params) {
  return fetch({
    url: SERVICE_URL + '/auth/login',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'post',
    data: params
  });
}

export function logout(params) {
  return fetch({
    url: SERVICE_URL + '/auth/logout',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'post',
    data: params
  });
}
